package com.taotao.async.task;

import com.google.common.base.Preconditions;

import java.util.concurrent.ConcurrentHashMap;

/**
 * <p>
 *
 * </p>
 *
 * @author fanbeibei
 * @version 1.0.0
 * @date 2024/5/29 21:16
 */
public class TaskHub {

    private static final ConcurrentHashMap<String, Task> tasks = new ConcurrentHashMap<String, Task>();


    public static void addTask(String code, Task t) {
        Preconditions.checkArgument(null != code);
        Preconditions.checkArgument(null != t);
        tasks.put(code, t);

    }

    public static Task getTask(String code) {
        Preconditions.checkArgument(null != code);
        return tasks.get(code);
    }


}
